Skip to content

CLAUDE.md: relax Reason interface invariant to match demo reality - #18

Merged
koriym merged 1 commit into
1.xfrom
relax-reason-interface-invariant
Apr 16, 2026
Merged

koriym merged 1 commit into
1.xfrom
relax-reason-interface-invariant

Conversation

@koriym

@koriym koriym commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Summary

CLAUDE.md §3 #8 declared an absolute rule — "always define an …Interface and depend on the interface, never the concrete class" — that the canonical demos themselves do not follow. A cross-demo audit of every #[Inject] site revealed a consistent, different policy in practice:

  • Interface required: Reasons at an external I/O boundary (HTTP, DB, payment gateway, third-party API, filesystem, clock, randomness).
    • Examples in the repo: PaymentGatewayInterface, CreditBureauInterface, DamageAppraiserInterface, AdjusterAllocatorInterface, FraudDetectorInterface, InsuranceQuoterInterface, PropertyAppraisalInterface, EmailVerifierInterface, AuthorResolverInterface, PolicyRegistryInterface, PaymentProcessorInterface, InventoryReserverInterface, ShippingArrangerInterface.
  • Interface optional: Reasons that are pure in-process policies or calculators with no I/O.
    • Examples injected as concrete classes: IncomePolicy, JTASProtocol, EmailNormalizer, PasswordHasher, SlugGenerator, ExcerptExtractor, MarkdownRenderer, CoverageValidator, ClaimRegistrar, GravatarResolver, CardValidator, InventoryChecker, WarehouseLocator, CarrierSelector, AddressValidator.

This PR rewrites §8 to document that observed policy, so code-generating assistants stop being told to always introduce an interface — which would add noise to pure-policy Reasons and make the demos less representative.

Related

Test plan

  • Doc-only change; no code touched.
  • Verified the stated split against every #[Inject] site in demos/*/src/Being/ and demos/*/src/Moment/.

The absolute "always define an …Interface" rule in §3 #8 was not
followed by the canonical demos themselves — across all eight demos
concrete Reason injection is used freely for pure-policy classes
(IncomePolicy, JTASProtocol, EmailNormalizer, PasswordHasher,
SlugGenerator, ExcerptExtractor, CoverageValidator, etc.), and
interfaces are reserved for Reasons at external I/O boundaries
(PaymentGateway, CreditBureau, DamageAppraiser, AdjusterAllocator,
FraudDetector, InsuranceQuoter, PropertyAppraisal, EmailVerifier,
AuthorResolver, PolicyRegistry, PaymentProcessor, InventoryReserver,
ShippingArranger).

The invariant now documents that observed policy instead of mandating
a rule nothing obeys.
@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@koriym has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 15 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 35 minutes and 15 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 512e33c2-430b-481b-bfa6-e51a8d6af56b

📥 Commits

Reviewing files that changed from the base of the PR and between 273ccaa and e9e9c35.

📒 Files selected for processing (1)
  • CLAUDE.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch relax-reason-interface-invariant

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@koriym
koriym merged commit 3ad4dc1 into 1.x Apr 16, 2026
25 checks passed
@koriym
koriym deleted the relax-reason-interface-invariant branch April 16, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant